﻿'Description:问题快反类
'Copyright (c) : 通力凯顿（北京）系统集成有限公司
'Writer:Yuxj
'create Date:2020-07-30
'Rewriter:
'Rewrite Date:
Imports BusinessRule.DTO
Imports BusinessRule.IBusiness
Imports DatabaseAccess.DBUtility
Imports Camstar.WebClient.WebServicesProxy.InSiteWebServices
Imports System.Data
Imports System.Text
Imports External.APICalling
Imports System.Data.OracleClient
Imports BusinessRule.Common
Imports DatabaseAccess.IDAL
Imports DatabaseAccess.DALFactory
Public Class uLMSProblemFeedbackBusiness
    Implements uLMSProblemFeedbackIBusiness

    Private dal As IOracleDAL = uMESDalContext.instance.GetDalObject()

    Function GetProblemFeedBackData(ByVal para As Dictionary(Of String, String)) As DataTable Implements IBusiness.uLMSProblemFeedbackIBusiness.GetProblemFeedBackData
        Dim sb As New StringBuilder
        sb.AppendLine(" SELECT pf.type,pf.problemfeedbackid,pf.problemtype,pf.problemprior,pf.problemdepartment,pf.createdate,pf.lastmodifydate,e.fullname createfullname,e1.fullname modifyfullname")
        If para.ContainsKey("Employeeid") Then
            sb.AppendLine(" ,pfd.problemstatus,pfd.problemfeedbackdetailid ")
        End If
        sb.AppendLine(" FROM problemfeedback pf")
        sb.AppendLine(" LEFT JOIN employee e ON e.employeeid=pf.createemployeeid")
        sb.AppendLine(" LEFT JOIN employee e1 ON e1.employeeid=pf.lastmodifyemployeeid  ")
        If para.ContainsKey("Employeeid") Then
            sb.AppendFormat(" LEFT JOIN problemfeedbackdetail pfd ON pf.problemfeedbackid=pfd.problemfeedbackid AND pfd.submitemployeeid='{0}'  AND pfd.problemstatus='0' ", para("Employeeid"))
        End If

        sb.AppendLine(" where 1=1 ")

        If para.ContainsKey("Type") Then
            sb.AppendFormat(" and Type='{0}'", para("Type"))
        End If

        If para.ContainsKey("problemdepartment") Then
            sb.AppendFormat("  and problemdepartment='{0}'", para("problemdepartment"))
        End If

        sb.AppendLine(" order by pf.type asc,pf.sequence asc ")
        Dim dt As DataTable = DatabaseHelper.Query_ReturnDatTable(sb.ToString)
        Return dt
    End Function

    Function Insert_SQCDP_FACTORY_MAINT(ByVal para As Dictionary(Of String, String)) As Boolean Implements uLMSProblemFeedbackIBusiness.Insert_SQCDP_FACTORY_MAINT
        Dim strSQL As String
        strSQL = <string> INSERT INTO sqcdp_factory_maint 
                     (sqcdptype, factoryid, itemname, planvalue, safevalue, isuse,
                     sqcdp_factory_maintid, createemployeeid, cycleunit,yearmonth) 
                        values ( :sqcdptype, :factoryid, :itemname, :planvalue, :safevalue, 0, 
                        :sqcdp_factory_maintid,:createemployeeid, :cycleunit,:yearmonth)</string>
        Dim insertpar(8) As OracleParameter

        insertpar(0) = DatabaseHelper.NewParameter(":sqcdptype", para("SQCDPType"), OracleType.VarChar)
        insertpar(1) = DatabaseHelper.NewParameter(":factoryid", para("FactoryId"), OracleType.VarChar)
        insertpar(2) = DatabaseHelper.NewParameter(":itemname", para("ItemName"), OracleType.VarChar)
        insertpar(3) = DatabaseHelper.NewParameter(":planvalue", para("PlanValue"), OracleType.Number)
        insertpar(4) = DatabaseHelper.NewParameter(":safevalue", para("SafeValue"), OracleType.Number)
        insertpar(5) = DatabaseHelper.NewParameter(":sqcdp_factory_maintid", para("SQCDP_FACTORY_MAINTID"), OracleType.VarChar)
        insertpar(6) = DatabaseHelper.NewParameter(":createemployeeid", para("EmployeeId"), OracleType.VarChar)
        insertpar(7) = DatabaseHelper.NewParameter(":cycleunit", para("CycleUnit"), OracleType.VarChar)
        insertpar(8) = DatabaseHelper.NewParameter(":yearmonth", para("YearMonth"), OracleType.VarChar)
 
        Return DatabaseHelper.ExecuteSql(strSQL, insertpar)
    End Function

    Function ufcProblemFeedback(ByVal ufcproblemid As String) As DataTable Implements IBusiness.uLMSProblemFeedbackIBusiness.ufcProblemFeedback
        Dim strsql As String =
            <string>
                SELECT u.mfgordername,u.engineno,pf.type FROM ufcproblem u
                 INNER JOIN Problemfeedbackdetail pd on u.problemfeedbackdetailid=pd.problemfeedbackdetailid
                 LEFT JOIN Problemfeedback pf ON pf.problemfeedbackid=pd.problemfeedbackid
                 WHERE u.ufcproblemid='{0}'
            </string>
        strsql = String.Format(strsql, ufcproblemid)
        Dim dt As DataTable = DatabaseHelper.Query_ReturnDatTable(strsql)
        Return dt
    End Function


    Function Modify_SQCDP_FACTORY_MAINT(ByVal para As Dictionary(Of String, String)) As Boolean Implements uLMSProblemFeedbackIBusiness.Modify_SQCDP_FACTORY_MAINT
        Dim strSQL As String
        strSQL = <string>update sqcdp_factory_maint set 
                    itemname=:itemname, planvalue=:planvalue, safevalue=:safevalue, 
                    isuse=:isuse,cycleunit=:cycleunit,YearMonth=:YearMonth,
                    modifyemployeeid=:modifyemployeeid,Modifytime=sysdate,sqcdptype=:sqcdptype
               where sqcdp_factory_maintid=:sqcdp_factory_maintid</string>
        Dim Updatepar(8) As OracleParameter

        Updatepar(0) = DatabaseHelper.NewParameter(":itemname", para("ItemName"), OracleType.VarChar)
        Updatepar(1) = DatabaseHelper.NewParameter(":planvalue", para("PlanValue"), OracleType.Number)
        Updatepar(2) = DatabaseHelper.NewParameter(":safevalue", para("SafeValue"), OracleType.Number)
        Updatepar(3) = DatabaseHelper.NewParameter(":isuse", para("IsUse"), OracleType.Number)
        Updatepar(4) = DatabaseHelper.NewParameter(":cycleunit", para("CycleUnit"), OracleType.VarChar)
        Updatepar(5) = DatabaseHelper.NewParameter(":YearMonth", para("YearMonth"), OracleType.VarChar)
        Updatepar(6) = DatabaseHelper.NewParameter(":modifyemployeeid", para("EmployeeId"), OracleType.VarChar)
        Updatepar(7) = DatabaseHelper.NewParameter(":sqcdptype", para("SQCDPType"), OracleType.VarChar)
        Updatepar(8) = DatabaseHelper.NewParameter(":sqcdp_factory_maintid", para("SQCDP_FACTORY_MAINTID"), OracleType.VarChar)

        Return DatabaseHelper.ExecuteSql(strSQL, Updatepar)

    End Function

    Function Query_SQCDP_FACTORY_MAINT(ByVal para As Dictionary(Of String, String)) As uMESProcessResult Implements uLMSProblemFeedbackIBusiness.Query_SQCDP_FACTORY_MAINT
        Dim sql As String =
            <string>
                SELECT f.factoryid,f.factoryname,e.fullname createfullname,e1.fullname modifyfullname,m.sqcdptype,
                DECODE(m.sqcdptype,0,'S指标',1,'Q指标',2,'C指标',3,'D指标',4,'P指标','其他指标') sqcdptypedesc,
                m.itemname,m.yearmonth,m.cycleunit,m.planvalue,m.safevalue,m.sqcdp_factory_maintid,DECODE(m.isuse,0,'是',1,'否') isuse
                  FROM sqcdp_factory_maint m
                LEFT JOIN factory f ON f.factoryid=m.factoryid
                LEFT JOIN employee e ON e.employeeid=m.createemployeeid
                LEFT JOIN employee e1 ON e1.employeeid=m.modifyemployeeid
                where 1=1
            </string>

        If para.ContainsKey("IsUse") Then
            sql += String.Format(" and m.isuse={0}", para("IsUse"))
        End If
        If para.ContainsKey("SQCDPType") Then
            sql += String.Format(" and sqcdptype={0}", para("SQCDPType"))
        End If

        If para.ContainsKey("YearMonth") Then
            sql += String.Format(" and YearMonth like '{0}%'", para("YearMonth"))
        End If

        If para.ContainsKey("ItemName") Then
            sql += String.Format(" and ItemName like '%{0}%'", para("ItemName"))
        End If

        Dim paraPage As New uMESPagingDataDTO
        paraPage.CurrentPageIndex = Convert.ToInt32(para("CurrentPageIndex"))
        paraPage.PageSize = Convert.ToInt32(para("PageSize").ToString)
        paraPage.strSQL = sql
        Dim result As uMESProcessResult = DatabaseHelper.RunProcedureForPage(paraPage)
        Return result
    End Function

    Function Query_SQCDP_FACTORY_MAINT_DT(ByVal para As Dictionary(Of String, String)) As DataTable Implements uLMSProblemFeedbackIBusiness.Query_SQCDP_FACTORY_MAINT_DT
        Dim sql As String =
            <string>
                SELECT f.factoryid,f.factoryname,e.fullname createfullname,e1.fullname modifyfullname,m.sqcdptype,
                DECODE(m.sqcdptype,0,'S指标',1,'Q指标',2,'C指标',3,'D指标',4,'P指标','其他指标') sqcdptypedesc,w.CENTERCOUNT,
                m.itemname,m.yearmonth,m.cycleunit,m.planvalue,m.safevalue,m.sqcdp_factory_maintid,DECODE(m.isuse,0,'是',1,'否') isuse
                  FROM sqcdp_factory_maint m
                LEFT JOIN factory f ON f.factoryid=m.factoryid
                LEFT JOIN employee e ON e.employeeid=m.createemployeeid
                LEFT JOIN employee e1 ON e1.employeeid=m.modifyemployeeid
            </string>
        If para.ContainsKey("WorkCenterID") Then
            sql += " LEFT JOIN (SELECT WM.SQCDP_FACTORY_MAINTID,wm.workcenterid, COUNT(1) CENTERCOUNT  "
            sql += "            FROM SQCDP_WORKCENTER_MAINT WM  GROUP BY WM.SQCDP_FACTORY_MAINTID,wm.workcenterid) W "
            sql += " on m.sqcdp_factory_maintid=w.SQCDP_FACTORY_MAINTID "
            sql += String.Format(" and w.workcenterid = '{0}'", para("WorkCenterID"))
        Else
            sql += " LEFT JOIN (SELECT WM.SQCDP_FACTORY_MAINTID,COUNT(1) CENTERCOUNT  "
            sql += "            FROM SQCDP_WORKCENTER_MAINT WM  GROUP BY WM.SQCDP_FACTORY_MAINTID) W "
            sql += " on m.sqcdp_factory_maintid=w.SQCDP_FACTORY_MAINTID "
        End If


        sql += " WHERE M.ISUSE=0 "
        If para.ContainsKey("SQCDPType") Then
            sql += String.Format(" and sqcdptype={0}", para("SQCDPType"))
        End If

        If para.ContainsKey("YearMonth") Then
            sql += String.Format(" and YearMonth like '{0}%'", para("YearMonth"))
        End If

        If para.ContainsKey("ItemName") Then
            sql += String.Format(" and ItemName like '%{0}%'", para("ItemName"))
        End If

        If para.ContainsKey("NotId") Then
            sql += String.Format(" and m.sqcdp_factory_maintid <> '{0}'", para("NotId"))
        End If

        Dim DT As DataTable = dal.StandardGetDataTable(sql.ToString)
        Return DT
    End Function

    Function Query_SQCDP_WORKCENTER_MAINT_DT(ByVal para As Dictionary(Of String, String)) As DataTable Implements uLMSProblemFeedbackIBusiness.Query_SQCDP_WORKCENTER_MAINT_DT
        Dim sql As String =
            <string>
                  SELECT m.sqcdp_factory_maintid,DECODE(m.sqcdptype,0,'S指标',1,'Q指标',2,'C指标',3,'D指标',4,'P指标','其他指标') sqcdptypedesc,
                  f.factoryid,f.factoryname,w.workcenterid,w.workcentername,m.itemname factoryitemname,wc.itemname,wc.planvalue,wc.safevalue,
                  wc.ValidUntil,wc.sqcdp_workcenter_maintid,m.cycleunit  
                FROM sqcdp_workcenter_maint wc
                LEFT JOIN sqcdp_factory_maint m ON m.sqcdp_factory_maintid=wc.sqcdp_factory_maintid
                LEFT JOIN Workcenter w ON w.workcenterid=wc.workcenterid
                LEFT JOIN factory f ON f.factoryid=m.factoryid
                WHERE wc.isuse=0
            </string>
        If para.ContainsKey("F_ID") Then
            sql += String.Format(" and m.sqcdp_factory_maintid='{0}'", para("F_ID"))
        End If

        If para.ContainsKey("WorkCenterId") Then
            sql += String.Format(" and wc.WorkCenterId='{0}'", para("WorkCenterId"))
        End If

        If para.ContainsKey("ItemName") Then
            sql += String.Format(" and wc.ItemName='{0}'", para("ItemName"))
        End If

        If para.ContainsKey("SQCDPType") Then
            sql += String.Format(" and m.SQCDPType='{0}'", para("SQCDPType"))
        End If

        If para.ContainsKey("YearMonth") Then
            sql += String.Format(" and m.YearMonth like '{0}%'", para("YearMonth"))
        End If

        Return dal.StandardGetDataTable(sql)
    End Function

    Function Query_SQCDP_WORKCENTER_MAINT(ByVal para As Dictionary(Of String, String)) As uMESProcessResult Implements uLMSProblemFeedbackIBusiness.Query_SQCDP_WORKCENTER_MAINT
        Dim sql As String =
            <string>
                  SELECT m.yearmonth, m.sqcdp_factory_maintid,m.sqcdptype,m.itemname factoryitemname,
                  DECODE(m.sqcdptype,0,'S指标',1,'Q指标',2,'C指标',3,'D指标',4,'P指标','其他指标') sqcdptypedesc,
                  f.factoryid,f.factoryname,w.workcenterid,w.workcentername,wd.completedate,wc.itemname,
                  wc.planvalue,wc.safevalue,wd.actualvalue,wc.sqcdp_workcenter_maintid,m.cycleunit ,wd.id,
                nvl(ufcp.probemcount,0) probemcount ，wd.status,'' statusdesc
                FROM sqcdp_workcenter_maint wc
                LEFT JOIN sqcdp_factory_maint m ON m.sqcdp_factory_maintid=wc.sqcdp_factory_maintid
                LEFT JOIN Workcenter w ON w.workcenterid=wc.workcenterid
                LEFT JOIN factory f ON f.factoryid=m.factoryid
                LEFT JOIN sqcdp_workcenter_maint_details wd ON wd.sqcdp_workcenter_maintid=wc.sqcdp_workcenter_maintid
                LEFT JOIN (SELECT COUNT(ufcproblemid) probemcount,problemfeedbackdetailid FROM ufcproblem 
                WHERE problemfeedbackdetailid>'0' GROUP BY problemfeedbackdetailid) ufcp 
                ON ufcp.problemfeedbackdetailid = wd.id                
                WHERE wc.isuse=0 AND m.isuse=0
            </string>
        Dim tmpDate As DateTime = DateTime.Now.Date
        sql += String.Format(" and ((m.cycleunit='天/次' and wd.completedate in (TO_DATE('{0:yyyy-MM-dd}','YYYY-MM-DD'),TO_DATE('{1:yyyy-MM-dd}','YYYY-MM-DD'))) ", tmpDate.AddDays(-1), tmpDate)
        tmpDate = tmpDate.AddDays(1 - tmpDate.DayOfWeek)
        sql += String.Format(" or (m.cycleunit='周/次' and wd.completedate in (TO_DATE('{0:yyyy-MM-dd}','YYYY-MM-DD'),TO_DATE('{1:yyyy-MM-dd}','YYYY-MM-DD'))) ", tmpDate.AddDays(-7), tmpDate)
        tmpDate = tmpDate.AddDays(1 - tmpDate.Day)
        sql += String.Format(" or (m.cycleunit='月/次' and wd.completedate in (TO_DATE('{0:yyyy-MM-dd}','YYYY-MM-DD'),TO_DATE('{1:yyyy-MM-dd}','YYYY-MM-DD')))  )", tmpDate.AddMonths(-1), tmpDate)

        If para.ContainsKey("F_ID") Then
            sql += String.Format(" and m.sqcdp_factory_maintid='{0}'", para("F_ID"))
        End If

        If para.ContainsKey("WorkCenterId") Then
            sql += String.Format(" and wc.WorkCenterId='{0}'", para("WorkCenterId"))
        End If

        If para.ContainsKey("ItemName") Then
            sql += String.Format(" and wc.ItemName='{0}'", para("ItemName"))
        End If

        If para.ContainsKey("SQCDPType") Then
            sql += String.Format(" and m.SQCDPType='{0}'", para("SQCDPType"))
        End If

        If para.ContainsKey("YearMonth") Then
            sql += String.Format(" and m.YearMonth like '{0}%'", para("YearMonth"))
        End If

        Dim paraPage As New uMESPagingDataDTO
        paraPage.CurrentPageIndex = Convert.ToInt32(para("CurrentPageIndex"))
        paraPage.PageSize = Convert.ToInt32(para("PageSize").ToString)
        paraPage.strSQL = sql
        Dim result As uMESProcessResult = DatabaseHelper.RunProcedureForPage(paraPage)
        Return result
    End Function

    Function Insert_SQCDP_CENTER_MAINT(ByVal para As Dictionary(Of String, String)) As Object() Implements uLMSProblemFeedbackIBusiness.Insert_SQCDP_CENTER_MAINT
        Dim strSQL As String
        strSQL = <string>INSERT INTO sqcdp_workcenter_maint 
                  (itemname, planvalue, safevalue,sqcdp_factory_maintid, createemployeeid,
                 sqcdp_workcenter_maintid,WorkCenterId,isuse,ValidUntil) 
                values ( :itemname, :planvalue, :safevalue,:sqcdp_factory_maintid, 
                :createemployeeid, :sqcdp_workcenter_maintid,:WorkCenterId,0,:ValidUntil)</string>
        Dim Insertpar(7) As OracleParameter

        Insertpar(0) = DatabaseHelper.NewParameter(":itemname", para("ItemName"), OracleType.VarChar)
        Insertpar(1) = DatabaseHelper.NewParameter(":planvalue", para("PlanValue"), OracleType.Number)
        Insertpar(2) = DatabaseHelper.NewParameter(":safevalue", para("SafeValue"), OracleType.Number)
        Insertpar(3) = DatabaseHelper.NewParameter(":sqcdp_factory_maintid", para("SQCDP_FACTORY_MAINTID"), OracleType.VarChar)
        Insertpar(4) = DatabaseHelper.NewParameter(":createemployeeid", para("EmployeeId"), OracleType.VarChar)
        Insertpar(5) = DatabaseHelper.NewParameter(":sqcdp_workcenter_maintid", para("SQCDP_CENTER_MAINTID"), OracleType.VarChar)
        Insertpar(6) = DatabaseHelper.NewParameter(":WorkCenterId", para("WorkCenterId"), OracleType.VarChar)
        Insertpar(7) = DatabaseHelper.NewParameter(":ValidUntil", para("ValidUntil"), OracleType.DateTime)
        Return New Object() {strSQL, Insertpar}
    End Function

    Function Modify_SQCDP_CENTER_MAINT(ByVal para As Dictionary(Of String, String)) As Object() Implements uLMSProblemFeedbackIBusiness.Modify_SQCDP_CENTER_MAINT
        Dim strSQL As String
        strSQL = <string>update sqcdp_workcenter_maint set 
            itemname=:itemname, planvalue=:planvalue, safevalue=:safevalue,
            modifyemployeeid=:modifyemployeeid,ValidUntil=:ValidUntil,Modifytime=sysdate
            where sqcdp_workcenter_maintid=:sqcdp_workcenter_maintid </string>
        Dim Insertpar(5) As OracleParameter
        Insertpar(0) = DatabaseHelper.NewParameter(":itemname", para("ItemName"), OracleType.VarChar)
        Insertpar(1) = DatabaseHelper.NewParameter(":planvalue", para("PlanValue"), OracleType.Number)
        Insertpar(2) = DatabaseHelper.NewParameter(":safevalue", para("SafeValue"), OracleType.Number)
        Insertpar(3) = DatabaseHelper.NewParameter(":modifyemployeeid", para("EmployeeId"), OracleType.VarChar)
        Insertpar(4) = DatabaseHelper.NewParameter(":ValidUntil", para("ValidUntil"), OracleType.DateTime)
        Insertpar(5) = DatabaseHelper.NewParameter(":sqcdp_workcenter_maintid", para("SQCDP_CENTER_MAINTID"), OracleType.VarChar)
       Return New Object() {strSQL, Insertpar}
    End Function

    Function Insert_SQCDP_CENTER_MAINT_DETAILS(ByVal para As Dictionary(Of String, String)) As Object() Implements uLMSProblemFeedbackIBusiness.Insert_SQCDP_CENTER_MAINT_DETAILS
        Dim strSQL As String
        strSQL = <string>INSERT INTO SQCDP_WORKCENTER_MAINT_DETAILS
                      (ID,SQCDP_WORKCENTER_MAINTID,  COMPLETEDATE,   STATUS)
                    VALUES  (:ID,:SQCDP_WORKCENTER_MAINTID,:COMPLETEDATE,0)</string>
        Dim Insertpar(2) As OracleParameter

        Insertpar(0) = DatabaseHelper.NewParameter(":ID", Guid.NewGuid().ToString, OracleType.VarChar)
        Insertpar(1) = DatabaseHelper.NewParameter(":SQCDP_WORKCENTER_MAINTID", para("SQCDP_WORKCENTER_MAINTID"), OracleType.VarChar)
        Insertpar(2) = DatabaseHelper.NewParameter(":COMPLETEDATE", para("CompleteDate"), OracleType.DateTime)
        Return New Object() {strSQL, Insertpar}
    End Function

    Function Modify_SQCDP_CENTER_MAINT_DETAILS(ByVal para As Dictionary(Of String, String)) As Object() Implements uLMSProblemFeedbackIBusiness.Modify_SQCDP_CENTER_MAINT_DETAILS
        Dim strSQL As String
        strSQL = <string>UPDATE SQCDP_WORKCENTER_MAINT_DETAILS SET
                       ACTUALVALUE= :ACTUALVALUE,
                       CREATEEMPLOYEEID= :CREATEEMPLOYEEID,
                       CREATEDATE= SYSDATE,
                       STATUS= :STATUS WHERE  ID  = :ID   </string>
        Dim updatepar(3) As OracleParameter

        updatepar(0) = DatabaseHelper.NewParameter(":ACTUALVALUE", para("actualvalue"), OracleType.VarChar)
        updatepar(1) = DatabaseHelper.NewParameter(":CREATEEMPLOYEEID", para("employeeid"), OracleType.VarChar)
        updatepar(2) = DatabaseHelper.NewParameter(":STATUS", para("status"), OracleType.Number)
        updatepar(3) = DatabaseHelper.NewParameter(":ID", para("id"), OracleType.VarChar)
        Return New Object() {strSQL, updatepar}
    End Function

    Function Delete_SQCDP_CENTER_MAINT_DETAILS(ByVal para As Dictionary(Of String, String)) As Boolean Implements uLMSProblemFeedbackIBusiness.Delete_SQCDP_CENTER_MAINT_DETAILS
        Dim strSQL As String
        strSQL = <string>Delete SQCDP_WORKCENTER_MAINT_DETAILS
                     WHERE SQCDP_WORKCENTER_MAINTID  = :SQCDP_WORKCENTER_MAINTID
                     AND COMPLETEDATE>:COMPLETEDATE  </string>
        Dim updatepar(1) As OracleParameter

        updatepar(0) = DatabaseHelper.NewParameter(":SQCDP_WORKCENTER_MAINTID", para("SQCDP_WORKCENTER_MAINTID"), OracleType.VarChar)
        updatepar(1) = DatabaseHelper.NewParameter(":COMPLETEDATE", para("CompleteDate"), OracleType.DateTime)
        Return DatabaseHelper.ExecuteSql(strSQL, updatepar)
    End Function
#Region "发动机期量"
    Function Query_Engine_PriorDays_MAINT(ByVal para As Dictionary(Of String, String)) As uMESProcessResult Implements uLMSProblemFeedbackIBusiness.Query_Engine_PriorDays_MAINT
        Dim strsql As String =
            <string>
                SELECT u.attributevalue engineno,ep.mfgorderid,wfs.workflowstepid,wfs.workflowstepname,ep.priordays,ep.priordaysunit,wfs.sequence FROM enginepartplan ep
                INNER JOIN mfgorder m ON m.mfgorderid=ep.mfgorderid
                LEFT JOIN Workflowstep wfs ON wfs.workflowstepid=ep.workflowstepid
                LEFT JOIN Userattribute u ON u.parentid=m.mfgorderid   
                where nvl2(ep.workflowstepid,'0','1')='0' and u.userattributename='发动机'
                    And ep.priordays > 0      
            </string>
        If para.ContainsKey("EngineNo") Then '点击查询
            strsql += String.Format(" AND u.attributevalue LIKE '%{0}%' ", para("EngineNo"))
        End If

        strsql += " GROUP BY u.attributevalue,ep.mfgorderid,wfs.workflowstepid,wfs.workflowstepname,ep.priordays,ep.priordaysunit ,wfs.sequence "
        strsql += " order by u.attributevalue,wfs.sequence asc "
        Dim paraPage As New uMESPagingDataDTO
        paraPage.CurrentPageIndex = Convert.ToInt32(para("CurrentPageIndex"))
        paraPage.PageSize = Convert.ToInt32(para("PageSize").ToString)
        paraPage.strSQL = strsql
        Dim result As uMESProcessResult = DatabaseHelper.RunProcedureForPage(paraPage)
        Return result
    End Function

    Function Query_Engine_MAINT(ByVal para As Dictionary(Of String, String)) As DataTable Implements uLMSProblemFeedbackIBusiness.Query_Engine_MAINT
        Dim strsql As String =
            <string>
                SELECT u.attributevalue engineno,ep.mfgorderid,wfs.workflowstepid,wfs.workflowstepname,wfs.sequence FROM enginepartplan ep
                INNER JOIN mfgorder m ON m.mfgorderid=ep.mfgorderid
                LEFT JOIN Workflowstep wfs ON wfs.workflowstepid=ep.workflowstepid
                LEFT JOIN Userattribute u ON u.parentid=m.mfgorderid   
                where nvl2(ep.workflowstepid,'0','1')='0' and u.userattributename='发动机'      
            </string>
        If para.ContainsKey("EngineNo") Then '点击查询
            strsql += String.Format(" AND u.attributevalue LIKE '%{0}%' ", para("EngineNo"))
        End If

        strsql += " GROUP BY u.attributevalue,ep.mfgorderid,wfs.workflowstepid,wfs.workflowstepname,wfs.sequence "
        strsql += " order by u.attributevalue,wfs.sequence asc "
        Dim dt As DataTable = dal.StandardGetDataTable(strsql)
        Return dt
    End Function

    Function QueryEnginePriordays(ByVal mfgorderid As String, ByVal stepid As String) As DataTable Implements uLMSProblemFeedbackIBusiness.QueryEnginePriordays
        Dim strsql As String =
            <string>
                SELECT ep.mfgorderid,ep.workflowstepid FROM enginepartplan ep                
                where ep.workflowstepid='{0}' and ep.mfgorderid='{1}' and ep.priordays>0
            </string>
        strsql = String.Format(strsql, stepid, mfgorderid)
        Dim dt As DataTable = dal.StandardGetDataTable(strsql)
        Return dt
    End Function

#End Region

#Region "发动机问题描述"
    Function QueryEngineExceptionDesc(ByVal mfgorderid As String, ByVal stepid As String) As DataTable Implements uLMSProblemFeedbackIBusiness.QueryEngineExceptionDesc
        Dim strsql As String =
            <string>
                SELECT ep.mfgorderid,ep.workflowstepid FROM enginepartplan ep                
                where ep.workflowstepid='{0}' and ep.mfgorderid='{1}' and ep.exceptiondesc is not null
            </string>
        strsql = String.Format(strsql, stepid, mfgorderid)
        Dim dt As DataTable = dal.StandardGetDataTable(strsql)
        Return dt
    End Function

    Function Query_Engine_Exception_MAINT(ByVal para As Dictionary(Of String, String)) As uMESProcessResult Implements uLMSProblemFeedbackIBusiness.Query_Engine_Exception_MAINT
        Dim strsql As String =
            <string>
                SELECT u.attributevalue engineno,ep.mfgorderid,wfs.workflowstepid,wfs.workflowstepname,ep.exceptiondesc,wfs.sequence FROM enginepartplan ep
                INNER JOIN mfgorder m ON m.mfgorderid=ep.mfgorderid
                LEFT JOIN Workflowstep wfs ON wfs.workflowstepid=ep.workflowstepid
                LEFT JOIN Userattribute u ON u.parentid=m.mfgorderid   
                where nvl2(ep.workflowstepid,'0','1')='0' and u.userattributename='发动机'
                    And ep.exceptiondesc is not null
            </string>
        If para.ContainsKey("EngineNo") Then '点击查询
            strsql += String.Format(" AND u.attributevalue LIKE '%{0}%' ", para("EngineNo"))
        End If

        strsql += " GROUP BY u.attributevalue,ep.mfgorderid,wfs.workflowstepid,wfs.workflowstepname, ep.exceptiondesc, wfs.sequence "
        strsql += " order by u.attributevalue,wfs.sequence asc "
        Dim paraPage As New uMESPagingDataDTO
        paraPage.CurrentPageIndex = Convert.ToInt32(para("CurrentPageIndex"))
        paraPage.PageSize = Convert.ToInt32(para("PageSize").ToString)
        paraPage.strSQL = strsql
        Dim result As uMESProcessResult = DatabaseHelper.RunProcedureForPage(paraPage)
        Return result
    End Function
#End Region
#Region "技术状态"
    Function Query_EngineTechStatus(ByVal para As Dictionary(Of String, String)) As uMESProcessResult Implements uLMSProblemFeedbackIBusiness.Query_EngineTechStatus
        Dim sql As String =
           <string>
                SELECT es.*,e.fullname, w.workcentername FROM enginetechstatus es
                LEFT JOIN workcenter w ON w.workcenterid=es.workcenterid
                LEFT JOIN employee e ON e.employeeid=es.createemployeeid
                WHERE 1=1
            </string>

        If para.ContainsKey("EngineNo") Then
            sql += String.Format(" and es.EngineNo like '%{0}%'", para("EngineNo"))
        End If
        If para.ContainsKey("Status") Then
            sql += String.Format(" and es.Status='{0}'", para("Status"))
        End If

        Dim paraPage As New uMESPagingDataDTO
        paraPage.CurrentPageIndex = Convert.ToInt32(para("CurrentPageIndex"))
        paraPage.PageSize = Convert.ToInt32(para("PageSize").ToString)
        paraPage.strSQL = sql
        Dim result As uMESProcessResult = DatabaseHelper.RunProcedureForPage(paraPage)
        Return result
    End Function
    Function Insert_EngineTechStatus(ByVal para As Dictionary(Of String, String)) As Boolean Implements uLMSProblemFeedbackIBusiness.Insert_EngineTechStatus
        Dim sb As New StringBuilder
        sb.AppendLine(" INSERT INTO enginetechstatus ")
        sb.AppendLine(" (engineno,productdesc,workflowstatus,workcenterid,status, createemployeeid,enginetechstatusid) values ( ")
        sb.AppendFormat("'{0}', '{1}', '{2}', '{3}', '{4}', '{5}','{6}' ",
                        para("EngineNo"), para("ProductDesc"), para("WFStatus"), para("WorkCenterId"), para("Status"), para("Employeeid"), para("Id"))
        sb.AppendLine(") ")
        Return dal.ExecuteSql(sb.ToString)
    End Function

    Function Modify_EngineTechStatus(ByVal para As Dictionary(Of String, String)) As Boolean Implements uLMSProblemFeedbackIBusiness.Modify_EngineTechStatus
        Dim sb As New StringBuilder
        sb.AppendLine(" update enginetechstatus set ")
        sb.AppendFormat(" engineno='{0}',productdesc='{1}',workflowstatus='{2}',workcenterid='{3}',status='{4}' where enginetechstatusid='{5}' ",
                        para("EngineNo"), para("ProductDesc"), para("WFStatus"), para("WorkCenterId"), para("Status"), para("Id"))
        Return dal.ExecuteSql(sb.ToString)
    End Function
#End Region

    ''' <summary>
    ''' 查询管理者标准作业信息
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetStandardOperationInfo(ByVal para As Dictionary(Of String, String)) As uMESProcessResult Implements uLMSProblemFeedbackIBusiness.GetStandardOperationInfo
        Dim strSql As String = String.Format(<string>
            SELECT E.FULLNAME OPERATEFULLNAME,MTC.ISCOMPELETE ,                 
                   MT.MANAGEROPERATIONFLOWID,  MT.CREATEEMPLOYEEID,
                   MT.CREATEDATE,MT.OPERATIONCONTENT,MT.TYPE,MT.LOCALTIME, MT.TIMENUM,                                           
                   MT.SQCDPTYPE, MT.CYCLE,MT.FACTORYID，MT.VALIDUNTIL
                FROM MANAGEROPERATIONFLOW MT
                LEFT JOIN EMPLOYEE E ON E.EMPLOYEEID = MT.CREATEEMPLOYEEID
                LEFT JOIN (SELECT  COUNT(MANAGEROPERATIONFLOWCOMPLETEID) ISCOMPELETE,
                 MANAGEROPERATIONFLOWID FROM MANAGEROPERATIONFLOWCOMPLETE 
            WHERE STATUS>0 GROUP BY MANAGEROPERATIONFLOWID)MTC
                ON MTC.MANAGEROPERATIONFLOWID = MT.MANAGEROPERATIONFLOWID
                WHERE 1=1 </string>.Value)
        If para.ContainsKey("createemployeeid") Then
            strSql += String.Format(" and mt.createemployeeid='{0}'", para("createemployeeid"))
        End If

        If para.ContainsKey("operateemployee") Then
            strSql += String.Format(" and mt.operateemployee='{0}'", para("operateemployee"))
        End If
        If para.ContainsKey("operationcontent") Then
            strSql += String.Format(" and mt.operationcontent like '%{0}%'", para("operationcontent"))
        End If
        If para.ContainsKey("type") Then
            strSql += String.Format(" and mt.type={0}", para("type"))
        End If
        If para.ContainsKey("sqcdptype") Then
            strSql += String.Format(" and mt.SQCDPTYPE={0}", para("sqcdptype"))
        End If

        Dim paraPage As New uMESPagingDataDTO
        paraPage.CurrentPageIndex = Convert.ToInt32(para("CurrentPageIndex"))
        paraPage.PageSize = Convert.ToInt32(para("PageSize").ToString)
        paraPage.strSQL = strSql.ToString

        Return DatabaseHelper.RunProcedureForPage(paraPage)
    End Function

    Function Exist_MANAGEROPERATIONFLOWCOMPLETE(ByVal para As Dictionary(Of String, String)) As Boolean Implements uLMSProblemFeedbackIBusiness.Exist_MANAGEROPERATIONFLOWCOMPLETE
        Dim strSQL As String
        strSQL = String.Format(<string>SELECT * FROM  MANAGEROPERATIONFLOWCOMPLETE
                     WHERE MANAGEROPERATIONFLOWID  = '{0}'
                     AND STATUS>0  </string>.Value, para("MANAGEROPERATIONFLOWID"))
        Dim dt = DatabaseHelper.Query_ReturnDatTable(strSQL)
        If dt.rows.count > 0 Then
            Return True
        Else
            Return False
        End If
    End Function

    Function Delete_MANAGEROPERATIONFLOWCOMPLETE(ByVal para As Dictionary(Of String, String)) As Boolean Implements uLMSProblemFeedbackIBusiness.Delete_MANAGEROPERATIONFLOWCOMPLETE
        Dim strSQL As String
        strSQL = <string>Delete MANAGEROPERATIONFLOWCOMPLETE
                     WHERE MANAGEROPERATIONFLOWID  = :MANAGEROPERATIONFLOWID
                     AND COMPLETEDATE>:COMPLETEDATE  </string>
        Dim updatepar(1) As OracleParameter

        updatepar(0) = DatabaseHelper.NewParameter(":MANAGEROPERATIONFLOWID", para("MANAGEROPERATIONFLOWID"), OracleType.VarChar)
        updatepar(1) = DatabaseHelper.NewParameter(":COMPLETEDATE", Date.Parse(para("CompleteDate")), OracleType.DateTime)
        Return DatabaseHelper.ExecuteSql(strSQL, updatepar)
    End Function

    Function GetManageCompleteEmployee(ByVal id As String) As DataTable Implements uLMSProblemFeedbackIBusiness.GetManageCompleteEmployee
        Dim strSQL As String =
            <string>                 
                SELECT e.fullname,e.employeename,e.employeeid,f.factoryname,wc.workcentername,s.shiftname,t.teamname
                    FROM MANAGEROPERATIONFLOWCOMPLETE w 
                LEFT JOIN employee e ON e.employeeid=w.createemployeeid
                LEFT JOIN Sessionvalues sv ON e.employeeid=sv.employeeid
                LEFT JOIN Workcenter wc ON wc.workcenterid=sv.workcenterid
                LEFT JOIN Factory f ON f.factoryid=sv.factoryid 
                LEFT JOIN shift s ON s.shiftid=e.shiftid
                LEFT JOIN teamemployee te ON te.employeeid=e.employeeid
                LEFT JOIN team t ON t.teamid=te.teamid      
                WHERE w.manageroperationflowid='{0}' 
                GROUP BY e.fullname,e.employeename,e.employeeid,f.factoryname,wc.workcentername,s.shiftname,t.teamname
            </string>
        strSQL = String.Format(strSQL, id)
        Return DatabaseHelper.Query_ReturnDatTable(strSQL)
    End Function

    ''' <summary>
    ''' SQCDP 年月计划查询
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function Query_SQCDP_YearMonth_MAINT(ByVal para As Dictionary(Of String, String)) As uMESProcessResult Implements uLMSProblemFeedbackIBusiness.Query_SQCDP_YearMonth_MAINT
        Dim sql As String =
            <string>
                SELECT ysp.createdate,
                       ysp.createemployeeid,
                       ysp.notes,
                       ysp.yearmonth,
                       ysp.completeqty,
                       ysp.yearmonth_sqcdp_planid,
                       ysp.planqty,
                       ysp.modifydate,
                       ysp.modifyemployeeid,
                       ysp.factoryid,
                       (nvl(ysp.planqty,0)-nvl(ysp.completeqty,0)) leftqty, 
                       ysp.sqcdptype,f.factoryname,e.fullname createfullname,e1.fullname modifyfullname,
                  DECODE(ysp.sqcdptype,0,'S指标',1,'Q指标',2,'C指标',3,'D指标',4,'P指标','其他指标') sqcdptypedesc
                FROM YEARMONTH_SQCDP_PLAN ysp
                LEFT JOIN employee e ON e.employeeid=ysp.createemployeeid
                LEFT JOIN employee e1 ON e1.employeeid=ysp.modifyemployeeid
                LEFT JOIN factory f ON f.factoryid=ysp.factoryid
                where 1=1
            </string>
        If para.ContainsKey("SQCDPType") Then
            sql += String.Format(" and ysp.sqcdptype={0}", para("SQCDPType"))
        End If

        If para.ContainsKey("YearMonth") Then
            sql += String.Format(" and ysp.YearMonth like '{0}%'", para("YearMonth"))
        End If

        Dim paraPage As New uMESPagingDataDTO
        paraPage.CurrentPageIndex = Convert.ToInt32(para("CurrentPageIndex"))
        paraPage.PageSize = Convert.ToInt32(para("PageSize").ToString)
        paraPage.strSQL = sql
        Dim result As uMESProcessResult = DatabaseHelper.RunProcedureForPage(paraPage)
        Return result
    End Function

    Function Query_SQCDP_YearMonth_MAINT_DT(ByVal para As Dictionary(Of String, String)) As DataTable Implements uLMSProblemFeedbackIBusiness.Query_SQCDP_YearMonth_MAINT_DT
        Dim sql As String =
            <string>
                SELECT 1
                  FROM YEARMONTH_SQCDP_PLAN ysp                
                WHERE 1=1
            </string>
        If para.ContainsKey("SQCDPType") Then
            sql += String.Format(" and sqcdptype={0}", para("SQCDPType"))
        End If

        If para.ContainsKey("YearMonth") Then
            sql += String.Format(" and YearMonth like '{0}%'", para("YearMonth"))
        End If

        If para.ContainsKey("FactoryId") Then
            sql += String.Format(" and YearMonth like '{0}%'", para("YearMonth"))
        End If

        If para.ContainsKey("NotId") Then
            sql += String.Format(" and yearmonth_sqcdp_planid <> '{0}'", para("NotId"))
        End If

        Dim DT As DataTable = dal.StandardGetDataTable(sql.ToString)
        Return DT
    End Function

    Function Modify_SQCDP_YEARMONTH_MAINT(ByVal para As Dictionary(Of String, String)) As Boolean Implements uLMSProblemFeedbackIBusiness.Modify_SQCDP_YEARMONTH_MAINT
        Dim strSQL As String
        strSQL = <string>update YEARMONTH_SQCDP_PLAN set 
                    planqty=:planvalue, completeqty=:completevalue, 
                    YearMonth=:YearMonth,
                    modifyemployeeid=:modifyemployeeid,Modifydate=sysdate,
                    sqcdptype=:sqcdptype,notes=:notes
               where yearmonth_sqcdp_planid=:yearmonth_sqcdp_planid</string>
        Dim Updatepar(6) As OracleParameter

        Updatepar(0) = DatabaseHelper.NewParameter(":planvalue", para("PlanValue"), OracleType.Number)
        Updatepar(1) = DatabaseHelper.NewParameter(":completevalue", para("CompleteValue"), OracleType.Number)
        Updatepar(2) = DatabaseHelper.NewParameter(":YearMonth", para("YearMonth"), OracleType.VarChar)
        Updatepar(3) = DatabaseHelper.NewParameter(":modifyemployeeid", para("EmployeeId"), OracleType.VarChar)
        Updatepar(4) = DatabaseHelper.NewParameter(":sqcdptype", para("SQCDPType"), OracleType.VarChar)
        Updatepar(5) = DatabaseHelper.NewParameter(":yearmonth_sqcdp_planid", para("Id"), OracleType.VarChar)
        Updatepar(6) = DatabaseHelper.NewParameter(":notes", para("Notes"), OracleType.VarChar)
        Return DatabaseHelper.ExecuteSql(strSQL, Updatepar)

    End Function

    Function Insert_YearMonth_MAINT(ByVal para As Dictionary(Of String, String)) As Boolean Implements uLMSProblemFeedbackIBusiness.Insert_YearMonth_MAINT
        Dim strSQL As String
        strSQL = <string> 
                    INSERT INTO YEARMONTH_SQCDP_PLAN 
                     (sqcdptype, factoryid, planqty, completeqty, 
                     yearmonth_sqcdp_planid, createemployeeid, yearmonth,notes) 
                        values ( :sqcdptype, :factoryid, :planvalue, :completevalue, 
                        :yearmonth_sqcdp_planid,:createemployeeid, :yearmonth,:notes)
                </string>
        Dim insertpar(7) As OracleParameter

        insertpar(0) = DatabaseHelper.NewParameter(":sqcdptype", para("SQCDPType"), OracleType.VarChar)
        insertpar(1) = DatabaseHelper.NewParameter(":factoryid", para("FactoryId"), OracleType.VarChar)
        insertpar(2) = DatabaseHelper.NewParameter(":yearmonth", para("YearMonth"), OracleType.VarChar)
        insertpar(3) = DatabaseHelper.NewParameter(":planvalue", para("PlanValue"), OracleType.Number)
        insertpar(4) = DatabaseHelper.NewParameter(":completevalue", para("CompleteValue"), OracleType.Number)
        insertpar(5) = DatabaseHelper.NewParameter(":yearmonth_sqcdp_planid", para("Id"), OracleType.VarChar)
        insertpar(6) = DatabaseHelper.NewParameter(":createemployeeid", para("EmployeeId"), OracleType.VarChar)
        insertpar(7) = DatabaseHelper.NewParameter(":notes", para("Notes"), OracleType.VarChar)
        Return DatabaseHelper.ExecuteSql(strSQL, insertpar)
    End Function

    '管理者标准作业维护 插入或更新时判断是否任务存在
    Function Exist_MANAGEROPERATIONFLOW(ByVal para As Dictionary(Of String, Object)) As Boolean Implements uLMSProblemFeedbackIBusiness.Exist_MANAGEROPERATIONFLOW
        Dim strSQL As String
        strSQL = <string>
                     SELECT 1 FROM  MANAGEROPERATIONFLOW where 1=1                     
                </string>
        If para.ContainsKey("operationcontent") Then
            strSQL += String.Format(" and operationcontent='{0}'  ", para("operationcontent"))
        End If

        If para.ContainsKey("manageroperationflowid") Then
            strSQL += String.Format(" and manageroperationflowid='{0}'  ", para("manageroperationflowid"))
        End If

        Dim dt = DatabaseHelper.Query_ReturnDatTable(strSQL)
        If dt.Rows.Count > 0 Then
            Return True
        Else
            Return False
        End If
    End Function


    ''' <summary>
    ''' 查询管理者标准作业完成信息
    ''' </summary>
    ''' <param name="para"></param>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Function GetStandardOperationCompInfo(ByVal para As Dictionary(Of String, String)) As uMESProcessResult Implements uLMSProblemFeedbackIBusiness.GetStandardOperationCompInfo
        Dim strSql As String = String.Format(<string>
       SELECT E.FULLNAME OPERATEFULLNAME, MT.MANAGEROPERATIONFLOWID, MT.CREATEEMPLOYEEID, 
        MT.CREATEDATE,MT.OPERATIONCONTENT,MT.TYPE,MT.LOCALTIME, MT.TIMENUM, 
        MT.SQCDPTYPE, MT.CYCLE,MT.FACTORYID，MT.VALIDUNTIL,MTC.STATUS ,  
        MTC.MANAGEROPERATIONFLOWCOMPLETEID,MTC.COMPLETEDATE,MD.TRANSFEREMPLOYEEID,
        md.managerflowoperationdetailid,'' isTransfer
        FROM MANAGEROPERATIONFLOW MT
        LEFT JOIN EMPLOYEE E ON E.EMPLOYEEID = MT.CREATEEMPLOYEEID
        LEFT JOIN  MANAGEROPERATIONFLOWCOMPLETE MTC   ON MTC.MANAGEROPERATIONFLOWID = MT.MANAGEROPERATIONFLOWID
        LEFT JOIN MANAGERFLOWOPERATIONDETAIL md 
        ON md.manageroperationflowcompleteid = mtc.manageroperationflowcompleteid AND md.isuse=0    
        WHERE MTC.Createemployeeid='{0}'  </string>.Value, para("createemployeeid"))

        If para.ContainsKey("type") Then
            strSql += String.Format(" and mt.type={0}", para("type"))
        End If
        If para.ContainsKey("status") Then
            strSql += String.Format(" and MTC.STATUS={0}", para("status"))
        End If
        Dim tmpDate As DateTime = DateTime.Now.Date
        strSql += String.Format(" and ((mt.cycle=0 AND MTC.Completedate=TO_DATE('{0:yyyy-MM-dd}','YYYY-MM-DD')) ", tmpDate)

        strSql += String.Format(" or (mt.cycle=1 AND MTC.Completedate=TO_DATE('{0:yyyy-MM-dd}','YYYY-MM-DD')) ", tmpDate)

        strSql += String.Format(" or (mt.cycle=2 AND MTC.Completedate=TO_DATE('{0:yyyy-MM-dd}','YYYY-MM-DD'))  ", tmpDate.AddDays(1 - tmpDate.DayOfWeek))

        strSql += String.Format(" or (mt.cycle=3 AND MTC.Completedate=TO_DATE('{0:yyyy-MM-dd}','YYYY-MM-DD'))  ", tmpDate.AddDays(1 - tmpDate.Day))

        strSql += String.Format(" or (mt.cycle=4 AND  trunc(MTC.Completedate,'mm') =  trunc(sysdate,'mm')  AND MTC.Completedate>=TO_DATE('{0:yyyy-MM-dd}','YYYY-MM-DD'))  ", tmpDate)

        strSql += String.Format(" or (mt.cycle=5 AND MTC.Completedate>=TO_DATE('{0:yyyy-MM-dd}','YYYY-MM-DD'))  )", tmpDate)
        strSql += " ORDER BY MT.MANAGEROPERATIONFLOWID"
        Dim paraPage As New uMESPagingDataDTO
        paraPage.CurrentPageIndex = Convert.ToInt32(para("CurrentPageIndex"))
        paraPage.PageSize = Convert.ToInt32(para("PageSize").ToString)
        paraPage.strSQL = strSql.ToString

        Return DatabaseHelper.RunProcedureForPage(paraPage)
    End Function

    Function Inherit_SQCDP_Factory_Maint(ByVal para As Dictionary(Of String, String)) As Boolean Implements uLMSProblemFeedbackIBusiness.Inherit_SQCDP_Factory_Maint
        Inherit_SQCDP_Factory_Maint = False
        Dim strsql As String =
            <string>
                INSERT INTO sqcdp_factory_maint(sqcdptype,factoryid,itemname,planvalue,safevalue,isuse,sqcdp_factory_maintid,
                    createtime,createemployeeid,cycleunit,yearmonth)
                    SELECT sf.sqcdptype,sf.factoryid,sf.itemname,sf.planvalue,sf.safevalue,sf.isuse,sys_guid() AS sqcdp_factory_maintid,
                    SYSDATE createtime,'{0}' createemployeeid,sf.cycleunit,to_char(SYSDATE,'yyyymm') yearmonth
                     FROM sqcdp_factory_maint sf
                    WHERE sf.isuse=0 AND sf.yearmonth=to_char(Add_Months(SYSDATE,-1),'yyyymm')
            </string>
        strsql = String.Format(strsql, para("EmployeeID"))
        Dim i As Integer = DatabaseHelper.ExecuteSql(strsql)
        If i > 0 Then
            Inherit_SQCDP_Factory_Maint = True
        End If

    End Function

    '看板公告信息维护
    Function BardNotesMaint(ByVal para As Dictionary(Of String, String)) As Boolean Implements uLMSProblemFeedbackIBusiness.BardNotesMaint
        BardNotesMaint = False
        Dim strsql As String =
           <string>
               UPDATE factory SET notes='{0}' WHERE factoryid='{1}'
            </string>
        strsql = String.Format(strsql, para("notes"), para("factoryid"))
        Dim i As Integer = DatabaseHelper.ExecuteSql(strsql)
        If i > 0 Then
            BardNotesMaint = True
        End If
        Return True
    End Function

    '看板公告信息查询
    Function GetBardNotes(ByVal para As Dictionary(Of String, String)) As String Implements uLMSProblemFeedbackIBusiness.GetBardNotes
        Dim strsql As String =
           <string>
               select notes from  factory WHERE factoryid='{0}'
            </string>
        strsql = String.Format(strsql, para("factoryid"))
        Dim result As Object = DatabaseHelper.GetSingle(strsql)
        If IsNothing(result) = False Then
            Return result.ToString
        Else
            Return ""
        End If
        Return True
    End Function
End Class
